Add flags field to VCPUOP_set_singlsehot_timer.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Sat, 10 Mar 2007 16:58:11 +0000 (16:58 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Sat, 10 Mar 2007 16:58:11 +0000 (16:58 +0000)
Flag 'future' causes Xen to check if the timeout is in the past and
return -ETIME if so.
From: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
xen/common/domain.c
xen/include/public/vcpu.h

index 92971bcac6382f4086438cd024e1935fc8ed707c..a3ac4371a480a9dfb549882bdd4aa348c9352414 100644 (file)
@@ -1008,6 +1008,7 @@ static void stop_hz_timer(void)
        }
 
        singleshot.timeout_abs_ns = jiffies_to_st(j);
+       singleshot.flags = 0;
        rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
 #ifdef XEN_COMPAT_030004
        if (rc) {
index 7b4660fc913044ba6ea0741145c3fa602cc4b646..57fb9ade71858bb22b1a1da7a3281521c7761c26 100644 (file)
@@ -623,6 +623,10 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
         if ( copy_from_guest(&set, arg, 1) )
             return -EFAULT;
 
+        if ( (set.flags & VCPU_SSHOTTMR_future) &&
+             (set.timeout_abs_ns < NOW()) )
+            return -ETIME;
+
         if ( v->singleshot_timer.cpu != smp_processor_id() )
         {
             stop_timer(&v->singleshot_timer);
index 3d7d9587c085d65298250e952687e82e7228634d..7252d0b793137335ed8316aca91a0159211c35dc 100644 (file)
@@ -150,11 +150,17 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_periodic_timer_t);
 #define VCPUOP_set_singleshot_timer  8 /* arg == vcpu_set_singleshot_timer_t */
 #define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
 struct vcpu_set_singleshot_timer {
-    uint64_t timeout_abs_ns;
+    uint64_t timeout_abs_ns;   /* Absolute system time value in nanoseconds. */
+    uint32_t flags;            /* VCPU_SSHOTTMR_??? */
 };
 typedef struct vcpu_set_singleshot_timer vcpu_set_singleshot_timer_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t);
 
+/* Flags to VCPUOP_set_singleshot_timer. */
+ /* Require the timeout to be in the future (return -ETIME if it's passed). */
+#define _VCPU_SSHOTTMR_future (0)
+#define VCPU_SSHOTTMR_future  (1U << _VCPU_SSHOTTMR_future)
+
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 
 /*